inspector: Make picking more robust
authorMatthias Clasen <mclasen@redhat.com>
Fri, 6 Jun 2014 17:35:40 +0000 (13:35 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 6 Jun 2014 17:35:40 +0000 (13:35 -0400)
Apparently ClutterOffscreen returns NULL as a window.
While that is not cool, we shouldn't crash.

gtk/inspector/inspect-button.c

index 639908fc37ad76f46d4124dfa7f7dedabaa9bd9c..dd21f0dc5a1ce3e3c7ebe23973b318666fd09ac1 100644 (file)
@@ -62,11 +62,16 @@ find_widget (GtkWidget      *widget,
 
   if (gtk_widget_get_parent (widget) && !data->first)
     {
-      GdkWindow *window = gtk_widget_get_window (widget);
+      GdkWindow *window;
+
+      window = gtk_widget_get_window (widget);
       while (window != gtk_widget_get_window (gtk_widget_get_parent (widget)))
         {
           gint tx, ty, twidth, theight;
 
+          if (window == NULL)
+            return;
+
           twidth = gdk_window_get_width (window);
           theight = gdk_window_get_height (window);